package com.bw.day_2.register

import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.ToastUtils
import com.bw.base.mvvm.BaseActivity
import com.bw.day_2.databinding.ActivityRegisterBinding
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class RegisterActivity : BaseActivity<ActivityRegisterBinding, RegisterViewModel>() {


    override fun initView() {
        binding.login.setOnClickListener {
            viewModel.register(binding.username.text.toString(),binding.password.text.toString())
        }
    }

    override fun initData() {
        viewModel.registerSuccess.observe(this){
            ToastUtils.showLong("注册成功")
            ARouter.getInstance().build("/app/LoginActivity")
                .navigation()
        }
    }
}